/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Usuario
 */
@Entity
@Table(name = "pre_registro", catalog = "Sig", schema = "")
@NamedQueries({
    @NamedQuery(name = "PreRegistro.findAll", query = "SELECT p FROM PreRegistro p"),
    @NamedQuery(name = "PreRegistro.findByIdPreregistro", query = "SELECT p FROM PreRegistro p WHERE p.idPreregistro = :idPreregistro"),
    @NamedQuery(name = "PreRegistro.findByValorCif", query = "SELECT p FROM PreRegistro p WHERE p.valorCif = :valorCif"),
    @NamedQuery(name = "PreRegistro.findByValorAduana", query = "SELECT p FROM PreRegistro p WHERE p.valorAduana = :valorAduana"),
    @NamedQuery(name = "PreRegistro.findByValorImponible", query = "SELECT p FROM PreRegistro p WHERE p.valorImponible = :valorImponible"),
    @NamedQuery(name = "PreRegistro.findByIva32", query = "SELECT p FROM PreRegistro p WHERE p.iva32 = :iva32"),
    @NamedQuery(name = "PreRegistro.findByCostoFinal", query = "SELECT p FROM PreRegistro p WHERE p.costoFinal = :costoFinal")})
public class PreRegistro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPre_registro", nullable = false)
    private Integer idPreregistro;
    @Basic(optional = false)
    @Column(name = "valorCif", nullable = false)
    private double valorCif;
    @Basic(optional = false)
    @Column(name = "valorAduana", nullable = false)
    private double valorAduana;
    @Basic(optional = false)
    @Column(name = "valorImponible", nullable = false)
    private double valorImponible;
    @Basic(optional = false)
    @Column(name = "iva32", nullable = false)
    private double iva32;
    @Basic(optional = false)
    @Column(name = "costoFinal", nullable = false)
    private double costoFinal;
    @JoinColumn(name = "idPre_registro", referencedColumnName = "idGastoImportacion", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Gastoimportacion gastoimportacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "preRegistro")
    private List<ProductopreRegistro> productopreRegistroList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "preRegistro")
    private List<Importacion> importacionList;

    public PreRegistro() {
    }

    public PreRegistro(Integer idPreregistro) {
        this.idPreregistro = idPreregistro;
    }

    public PreRegistro(Integer idPreregistro, double valorCif, double valorAduana, double valorImponible, double iva32, double costoFinal) {
        this.idPreregistro = idPreregistro;
        this.valorCif = valorCif;
        this.valorAduana = valorAduana;
        this.valorImponible = valorImponible;
        this.iva32 = iva32;
        this.costoFinal = costoFinal;
    }

    public Integer getIdPreregistro() {
        return idPreregistro;
    }

    public void setIdPreregistro(Integer idPreregistro) {
        this.idPreregistro = idPreregistro;
    }

    public double getValorCif() {
        return valorCif;
    }

    public void setValorCif(double valorCif) {
        this.valorCif = valorCif;
    }

    public double getValorAduana() {
        return valorAduana;
    }

    public void setValorAduana(double valorAduana) {
        this.valorAduana = valorAduana;
    }

    public double getValorImponible() {
        return valorImponible;
    }

    public void setValorImponible(double valorImponible) {
        this.valorImponible = valorImponible;
    }

    public double getIva32() {
        return iva32;
    }

    public void setIva32(double iva32) {
        this.iva32 = iva32;
    }

    public double getCostoFinal() {
        return costoFinal;
    }

    public void setCostoFinal(double costoFinal) {
        this.costoFinal = costoFinal;
    }

    public Gastoimportacion getGastoimportacion() {
        return gastoimportacion;
    }

    public void setGastoimportacion(Gastoimportacion gastoimportacion) {
        this.gastoimportacion = gastoimportacion;
    }

    public List<ProductopreRegistro> getProductopreRegistroList() {
        return productopreRegistroList;
    }

    public void setProductopreRegistroList(List<ProductopreRegistro> productopreRegistroList) {
        this.productopreRegistroList = productopreRegistroList;
    }

    public List<Importacion> getImportacionList() {
        return importacionList;
    }

    public void setImportacionList(List<Importacion> importacionList) {
        this.importacionList = importacionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPreregistro != null ? idPreregistro.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PreRegistro)) {
            return false;
        }
        PreRegistro other = (PreRegistro) object;
        if ((this.idPreregistro == null && other.idPreregistro != null) || (this.idPreregistro != null && !this.idPreregistro.equals(other.idPreregistro))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.PreRegistro[idPreregistro=" + idPreregistro + "]";
    }

}
